import requests
from config import url, headers_web,headers_wechat

class ClassSummary:
    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_all_classsummary_info_on_teacher(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:接口-学生个人平均活跃度、班级平均活跃度统计
        @Description:云课堂学生端学生参与度使用
        :param url_path:/teachingApi/v1/classsummary/answeractivity
        :param params:{
                'classTimesNum':'', #课次
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'validCode':''#验证码（courseId=?&signKey=123123）
                }
        :param headers:
        :return:{
                'AnswerAverageParticipation':'',#答题平均参与度
                'answerParticipation':[{
                    'answerTitle':'',#答题标题
                    'participation'':''#参与度
                    }]
                }
        """
        url_path = url_path + "/teachingApi/v1/classsummary/answeractivity"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_all_classsummary_list_on_teacher(cls,url_path:str,params=None,headers=headers_wechat):
        """
        @Summary:获取课堂小结小程序老师端课堂小结列表信息
        @Description:小程序老师端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/appletlist
        :param params:{
                'classTimesNum':'', #课次
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'validCode':''#验证码（courseId=?&signKey=123123）
                }
        :param headers:
        :return:{
                'classTimesName':'', #课次名称
                'classTimesNum':'',#课次编号
                'classroomInteractionParticipation':'',#课堂活动参与度
                'greenboardNum':'',#板书资源数量
                'signInPercentage':''#出勤率
                }
        """

        url_path = url_path + "/teachingApi/v1/classsummary/appletlist"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_attendance_activity_classsummary_on_teacher(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:获取课堂小结老师端考勤签到信息
        @Description:web老师端课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/attendanceactivity
        :param params:{
                'classTimesNum':'', #课次
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'validCode':''#验证码（courseId=?&signKey=123123）
                }
        :param headers:
        :return:{
                'signInPercentage':'',#出勤率
                'notSignInStudent':[],
                'signInStudent':[]
                }
        """

        url_path = url_path + "/teachingApi/v1/classsummary/attendanceactivity"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def post_attendance_activity_classsummary_on_student(cls,url_path:str,params=None,headers=headers_web,json=None):
        """
        @Summary:获取课堂小结学生端考勤签到信息
        @Description:web学生课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/attendanceactivity/studentId
        :param params:validCode:验证码（courseId=?&signKey=123123）
        :param headers:
        :param json:body:{
                'classTimesNum':'', #课次
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'studentId':''#学生id
                }
        :return:{
                'attendanceActivityTitle':'',#考勤签到标题
                'attendanceStatus':''#学生考勤状态 0：未考勤 1：考勤成功 2：考勤失败 3：病假 4：事假
                }
        """
        url_path = url_path + "/teachingApi/v1/classsummary/attendanceactivity/studentId"
        r = requests.post(url=url_path, headers=headers, params=params,json=json)
        return r

    @classmethod
    def get_attendance_info_classsummary_on_student(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:获取课堂小结小程序学生端端课堂小结课次和考勤信息
        @Description:小程序学生端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/attendanceactivity/studentid
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'studentId':''#学生id
                }
        :param headers:
        :return:{
                'classTimesName':'',#课次名称
                'classTimesNum':'',#课次编号
                'AttendanceDetailList':[{
                    'attendanceActivityTitle':'',#考勤签到标题
                    'attendanceStatus':''#学生考勤状态 0：未考勤 1：考勤成功 2：考勤失败 3：病假 4：事假
                    }]
                }
        """
        url_path = url_path + "/teachingApi/v1/classsummary/attendanceactivity/studentid"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_classroom_interaction_classsummary_on_teacher_web(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary:获取课堂小结web老师端课堂互动信息
        @Description:web老师端课堂小结列表调用
        :param url_path:/teachingApi/v1/classsummary/classroominteraction
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """

        url_path = url_path + "/teachingApi/v1/classsummary/classroominteraction"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_classroom_interaction_classsummary_on_teacher_wechat(cls,url_path:str,params=None,headers=headers_wechat):
        """
        @Summary:获取课堂小结小程序老师端课堂互动信息
        @Description:小程序老师端课堂小结列表调用
        :param url_path:/teachingApi/v1/classsummary/classroominteraction/applet
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """

        url_path = url_path + "/teachingApi/v1/classsummary/classroominteraction/applet"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def post_classroom_interaction_classsummary_on_student_wechat(cls,url_path:str,params=None,headers=headers_wechat,json=None):
        """
        @Summary:获取课堂小结小程序学生端课堂互动信息
        @Description:小程序学生端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/classroominteraction/studentId
        :param params:validCode:验证码（courseId=?&signKey=123123）
        :param headers:
        :param json:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/classroominteraction/studentId"
        r = requests.post(url=url_path, headers=headers, params=params,json=json)
        return r

    @classmethod
    def post_classsummary_detail(cls,url_path:str,params=None,headers=headers_web,json=None):
       """
        @Summary:学生课堂小结详情根据课次导出
        @Description:web端课堂小结调用
       :param url_path:/teachingApi/v1/classsummary/classtimesnum/detail
       :param params:validCode:验证码（&signKey=123123）
       :param headers:
       :param json:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
       :return:
       """

       url_path = url_path + "/teachingApi/v1/classsummary/classtimesnum/detail"
       r = requests.post(url=url_path, headers=headers, params=params, json=json)
       return r

    @classmethod
    def post_export_classsummary_detail(cls, url_path: str, params=None, headers=headers_web, json=None):
        """
        @Summary:学生课堂小结详情根据课次导出
        @Description:web端课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/classtimesnum/export
        :param params: 'validCode':'', #验证码（courseId=?&signKey=123123）
        :param headers:
        :param json:
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/classtimesnum/export"
        r = requests.post(url=url_path, headers=headers, params=params, json=json)
        return r

    @classmethod
    def get_classsummary_discussion_activity(cls, url_path: str, params=None, headers=headers_web):
        """
        @Summary:获取课堂小结分组分数信息
        @Description:web老师端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/discussionactivity
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/discussionactivity"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def  get_classsummary_greenboard_resource(cls, url_path: str, params=None, headers=headers_web):
        """
        @Summary:获取课堂小结课堂板书信息
        @Description:web老师端课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/greenboardresource
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """

        url_path = url_path + "/teachingApi/v1/classsummary/greenboardresource"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_classsummary_memo(cls, url_path: str, params=None, headers=headers_web):
        """
        @Summary:获取课堂小结教学备忘详情
        @Description:web老师端课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/memo
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/memo"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def post_edit_memo(cls,url_path:str,params=None,headers=headers_web,json=None):
        """
        @Summary: 添加与编辑课堂小结教学备忘内容
        @Description:web老师端课堂小结调用
        :param url_path:/teachingApi/v1/classsummary/memo/edit
        :param params:  'validCode':'', #验证码（&signKey=123123）
        :param headers:
        :param json:{
                    'classTimesName':'',#名称
                    'classTimesNum':'',#课次
                    'courseId':'',#课程id
                    'courseName':'',#课程名称
                    'creatorId':'',#教师ID
                    'creatorName':'',#教师名称
                    'groupId':'',#组id
                    'groupName':'',#组名称
                    'schoolYear':'',#学年
                    'teachingMemoContent':'',#教学备忘内容
                    'term':''#学期
                    }
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/memo/edit"
        r = requests.post(url=url_path, headers=headers, params=params,json=json)
        return r

    @classmethod
    def get_classummary_rate_and_applet(cls,url_path:str,params=None,headers=headers_wechat):
        """
         @Summary: 学生课堂小结详情获取出勤率与参与度
        @Description:小程序学生端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/rate/applet
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/rate/applet"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def get_classummary_teaching_assignment(cls,url_path:str,params=None,headers=headers_web):
        """
        @Summary: 获取课堂小结web老师端课堂测验信息
        @Description:web老师端课堂小结详情调用
        :param url_path:/teachingApi/v1/classsummary/teachingassignment
        :param params:{
                'validCode':'', #验证码（courseId=?&signKey=123123）
                'courseId':'',#课程id
                'groupIds':'',#组ids
                'ischoolYeard':'',#学年
                'term':'',#学期
                'classTimesNum':''#课次
                }
        :param headers:
        :return:
        """
        url_path = url_path + "/teachingApi/v1/classsummary/teachingassignment"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r